package com.vshop.controller.alast.homepage;

import com.vshop.config.dto.ResultDataDto;
import com.vshop.entity.alast.homepage.request.RequestUnifiedHomePage;
import com.vshop.entity.alast.homepage.response.ResponseUnifiedHomePage;
import com.vshop.service.alast.LogicProcessesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 统一入口首页
 * <p>
 * 包含带渠道码的页面内容展示.
 * 如果没有带渠道码按照领科默认展示
 *
 * @author lm
 * @date 2020/6/30 14:54
 */
@RestController
@Api(value = "统一入口首页接口")
public class HomeController {

    @Autowired
    LogicProcessesService homeService;

    /**
     * 统一入口：首页接口请求
     *
     * @param request
     * @return
     */
    @CrossOrigin
    @PostMapping(value = "homePage", produces = "application/json;charset=utf-8")
    @ApiOperation(value = "统一入口：默认首页接口", response = ResponseUnifiedHomePage.class)
    public ResultDataDto homePage(@ApiParam @RequestBody RequestUnifiedHomePage request) {
        return homeService.homePage(request);
    }

    /**
     * 统一入口：首页接口请求
     *
     * @param request
     * @return
     */
    @CrossOrigin
    @PostMapping(value = "multiple", produces = "application/json;charset=utf-8")
    @ApiOperation(value = "统一入口：点击'Multiple'按钮")
    public ResultDataDto multiple(@ApiParam @RequestBody RequestUnifiedHomePage request) {
        return homeService.multiple(request);
    }
}
